package rexsee.script;

import rexsee.core.browser.Browser;

public class ScriptParser {

	private final Browser mBrowser;
	public Function mainFunction = null;

	public ScriptParser(Browser browser) {
		mBrowser = browser;
	}

	public ScriptParser parse(String script) {
		mainFunction = new Function(null, clean(script));
		return this;
	}

	public void debug() {
		mBrowser.application.alert(mainFunction.getScript());
	}

	public static String clean(String str) {
		str = str.replace("\r", "");
		str = str.replace("\n", "");
		str = str.replace("\t", "");
		/*TODO
		 * remove comments
		 */
		return str;
	}

}
